package com.hellowx_ssm.controller;

import com.hellowx_ssm.entity.User;
import com.hellowx_ssm.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by IntelliJ IDEA.
 *
 * @author MagicMushroom
 * @date 2021/6/25
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @ResponseBody
    @RequestMapping("/hello")
    public String sayHello(){
        return "hello";
    }

    @ResponseBody
    @RequestMapping("/login")
    public User login(User user){
        User u = userService.login(user);
        System.out.println(u);
        return u;
    }
}
